package net.loodies;


import net.loodies.LoodiesAd;

import net.loodies.Manager;

import android.app.Activity;
import android.content.Context;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import java.util.ArrayList;
public class RadiomeeLoodiesWrapper {

	
	// <!-- Android Ad Loodies/Swelen Slots ids -->
	public static Integer numLoodiesAdCount = new Integer(0);
	public static String menu_radio_ad_slotd_id		="fixed-320x50-test";
	public static String menu_podcast_ad_slotd_id	="fixed-320x50-test";
	public static String menu_titles_ad_slotd_id	="fixed-320x50-test";
	public static String splashscreen_ad_slotd_id	="splashscreen-test";
	public static String home_ad_slotd_id			="travelling-200x200-test";
	public static String radioplayer_ad_slotd_id	="travelling-200x200-test";
	public static String podcastplayer_ad_slotd_id	="travelling-200x200-test";
	public static String news_ad_slotd_id			="fixed-320x50-test";
	public static String horoscope_ad_slotd_id		="travelling-200x200-test";
	public static String weather_ad_slotd_id		="travelling-200x200-test";
        
	private static final String TAG = "RadiomeeLoodiesWrapper";
	
	private static boolean DO_USE_LOODIES = true;

	private static Activity 			mActivityForNewsView;
	
	public static void RadiomeeAddAdHome(Activity activity){
		
		if(DO_USE_LOODIES){
			net.loodies.LoodiesWrapper.RemoveLastAd();
			net.loodies.LoodiesWrapper.setGravity(4.8f);
			net.loodies.LoodiesWrapper.setDuration(8000);
			net.loodies.LoodiesWrapper.AddAd(activity, net.loodies.LoodiesWrapper.home_ad_slotd_id);
		}	
	}
	public static void RadiomeeAddAdRadioPlayer(Activity activity){
		if(DO_USE_LOODIES){
			net.loodies.LoodiesWrapper.RemoveLastAd();
			net.loodies.LoodiesWrapper.setGravity(4.8f);
			net.loodies.LoodiesWrapper.setDuration(8000);
			net.loodies.LoodiesWrapper.AddAd(activity, net.loodies.LoodiesWrapper.radioplayer_ad_slotd_id);
		}
	}

	public static void RadiomeeAddAdPodcastPlayer(Activity activity){
		if(DO_USE_LOODIES){
			net.loodies.LoodiesWrapper.RemoveLastAd();
			net.loodies.LoodiesWrapper.setGravity(4.8f);
			net.loodies.LoodiesWrapper.setDuration(8000);
			net.loodies.LoodiesWrapper.AddAd(activity, net.loodies.LoodiesWrapper.podcastplayer_ad_slotd_id);
		}
	}

	public static void RadiomeeArticleNoAdds(){
		if(DO_USE_LOODIES){
			LoodiesWrapper.RemoveAllAds();
		}
	}
	
	public static void RadiomeeMenuRadio(Activity activity){
		if(DO_USE_LOODIES){
			LoodiesWrapper.AddAd(activity, menu_radio_ad_slotd_id);
		}
	}
	public static void RadiomeeMenuPodcast(Activity activity){
		if(DO_USE_LOODIES){
			LoodiesWrapper.AddAd(activity, menu_podcast_ad_slotd_id);
		}
	}
	public static void RadiomeeMenuTitles(Activity activity){
		if(DO_USE_LOODIES){
			LoodiesWrapper.AddAd(activity, menu_titles_ad_slotd_id);
		}
	}
	public static void RadiomeeSetActivityForNewsView(Activity activity){
		
		if(DO_USE_LOODIES){
			mActivityForNewsView = activity;
		}
	}
	public static void RadiomeeRemoveAllAds() {
		if(DO_USE_LOODIES){
			LoodiesWrapper.RemoveAllAds();
		}
	}
	public static void RadiomeeBrowsingNewsGetBack() {
		if(DO_USE_LOODIES){
			LoodiesWrapper.RemoveAllAds();
			if(mActivityForNewsView == null){
				Log.e(TAG, "mActivityForNewsView is null");	
				return;
			}
			LoodiesWrapper.AddAd(mActivityForNewsView,news_ad_slotd_id);
		}
	}
	public static void RadiomeeArticleKeyBack() {
		if(DO_USE_LOODIES){
			LoodiesWrapper.RemoveAllAds();
			if(mActivityForNewsView == null){
				Log.e(TAG, "mActivityForNewsView is null");	
				return;
			}
			LoodiesWrapper.AddAd(mActivityForNewsView,news_ad_slotd_id);
		}
		
	}
	public static LoodiesAd RadiomeeAddSplashScreenAd(Callback cb,Activity activity) {
		if(DO_USE_LOODIES){
			return LoodiesWrapper.AddAd(cb,activity, splashscreen_ad_slotd_id);
		}
		return null;
	}
}
